home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
filevirus26alib.lha
/
examples
/
fvshow.c
< prev
Wrap
C/C++ Source or Header
|
1993-03-30
|
2KB
|
75 lines
/* ----------------------------------------------------------------
*
* Project: Filevirus Library
*
* Program: fvshow.c
*
* Author : Bjorn Reese <breese@imada.ou.dk>
*
* Short : Example showing fvShow(Next)FVInfo.
* Compile with "sc LINK fvshow.c"
*
* ---------------------------------------------------------------- */
#include <stdio.h>
#include <exec/types.h>
#include <proto/exec.h>
#include <libraries/filevirus.h>
#include <proto/filevirus.h>
extern struct Library *SysBase;
struct FilevirusBase *FilevirusBase=NULL;
/* ---------------------------------------------------------------- */
int main(void)
{
struct FilevirusNode *p;
struct FilevirusInfo *pi;
char *xs;
if ( FilevirusBase = (struct FilevirusBase *)OpenLibrary("filevirus.library", 2) ) {
if ( p = fvAllocNode() ) {
printf("Known viruses [total: %d]\n", FilevirusBase->fb_VInfoTotal);
for ( pi = fvShowFVInfo(p); pi; pi = fvShowNextFVInfo(p) ) {
switch (pi->fvi_Type) {
case FV_LINK:
xs = "link";
break;
case FV_DELETE:
xs = "delete";
break;
case FV_RENAME:
xs = "rename";
break;
case FV_CODE:
xs = "code";
break;
case FV_OVERLAY:
xs = "overlay";
break;
default:
xs = "unknown";
break;
}
printf(" %4d %-40s (%s)\n", p->fv_VInfoCount, pi->fvi_Name, xs);
}
fvFreeNode(p);
} else fprintf(stderr, "fvAllocNode() failed\n");
CloseLibrary((struct Library *)FilevirusBase);
} else fprintf(stderr, "Cannot open 'filevirus.library'\n");
}